package chapter2.src.com.kkb.array;


import org.junit.Test;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;



class TestLinkedHashMap {
	
//	 LinkedHashMap<String,String> map = new LinkedHashMap<>();

	public  static 	LinkedHashMap<String, String>  getDateIncomeMap( ){
		LinkedHashMap<String, String> map = new LinkedHashMap<>();
		map.put(  "2020-01-01", "11"  );
		map.put(  "2020-01-04", "44"  );
		map.put(  "2020-01-03", "33"  );
		map.put(  "2020-01-02", "22"  );
		map.put(  "2020-01-06", "66"  );
		map.put(  "2020-01-05", "55"  );

		return map;
	}




	 
	 LinkedHashMap<String,String> map = new LinkedHashMap<>(16,0.75F,true);
	 {
		 map.put("A","1");
		 map.put("B","2");
	     map.put("C","3");
		 map.get("B");
	 }
	 

	@Test
	void testEntry() {
		Set<Map.Entry<String,String>> entrySet = map.entrySet();
		for(Map.Entry<String,String> entry : entrySet ){
		      System.out.println(entry.getKey()+"---"+entry.getValue());
	       }
	}
	
	@Test
	void testIterator() {
		Iterator<Map.Entry<String,String>> iterator = map.entrySet().iterator();
		while(iterator.hasNext()){
	          Map.Entry<String,String> entry = iterator.next();
		        System.out.println(entry.getKey()+"----"+entry.getValue());
	     }
	}
	
	@Test
	public  void  testSort(){
		LinkedHashMap<String, String> map = getDateIncomeMap();




	}

}
